import java.util.Arrays;

/**
 * Created by 84995 on 2020/1/15.
 */
public class test11 {

    public static void main(String[] args) {


        int []oldArr={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5};


        int conut=0;
        for (int i = 0; i <oldArr.length ; i++) {
            if (oldArr[i]!=0){
conut++;
            }
        }
        int newArr[]=new int[conut];

        int aa=0;
        for (int i : oldArr) {
            if (i!=0){
                newArr[aa]=i;
                aa++;
            }
        }

        System.out.println(Arrays.toString(newArr));

    }
}
